package org.nanfang.test14;

import java.util.Objects;
//第一把锁
public class OneThreald extends Thread{
    //第一把锁
    public static final Object ONE_Lock = new Object();
    @Override
    public void run() {
        synchronized (ONE_Lock){
            System.out.printf("获取第一把锁%s,执行相关的业务代码 %n","ONE_Lock");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            synchronized (TwoThreald.Two_Lock){
                System.out.printf("获取第二把锁%s,执行相关的业务代码 %n","Two_Lock");
            }
        }

    }
}
